<?php

namespace app\model\activity;

use app\base\BaseModel;
use app\model\goods\GoodsStoreModel;
use think\model\concern\SoftDelete;

/**
 * 模型-ActivityGoodsModel
 * Class ActivityGoodsModel
 * @package app\model
 */
class ActivityModel extends BaseModel
{
    use SoftDelete;
    protected $name = 'activity';

    public function getActivityId()
    {
        $activity = $this->where('status', 1)
            ->field('id')
            ->where('start_time', '<=', time())
            ->where('end_time', '>=', time())->find();
        if (empty($activity)) {
            return 0;
        }
        return $activity['id'];
    }
}
